﻿namespace ModuleMock.ViewModels
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Input;
    using System.ComponentModel;
    using Microsoft.Practices.Prism.Events;
    using Microsoft.Practices.ServiceLocation;
    using Microsoft.Practices.Unity;
    using Microsoft.Practices.Prism.Regions;
    using Microsoft.Practices.Prism.Commands;
    using ModulesInfrastructure.ViewModels;
    using EventInfrastructure;
    using ShellInfrastructure;
    using ModuleMock.Views;

    public class MockViewModel:SharedViewModel, IMockViewModel
    {
        private IEventAggregator m_eventAggregator;
        [Dependency]
        public IRegionManager RegionManager { get; set; }

        public MockViewModel(IEventAggregator eventAggregator)
        {
            this.m_eventAggregator = eventAggregator;
            eventAggregator.GetEvent<SelectCategoryEvent>().Subscribe(onSelectCategoryEvent);
        }

        private void onSelectCategoryEvent(bool b)
        {
            RegionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
            IRegion region = RegionManager.Regions[RegionNames.RightRegionName];
            region.Activate(ServiceLocator.Current.GetInstance<IMockView>());
        }

    }
}
